<template>
    <div>
        <div class="crumbs">
            <el-breadcrumb separator="/">
                <el-breadcrumb-item>
                    <div class="contentsize">房屋巡查</div>
                </el-breadcrumb-item>
            </el-breadcrumb>
        </div>
        <div class="container">
            <div class="handle-box">
                <el-form ref="form" :model="form" label-width="120px" :inline="true" size="mini">
                    <el-form-item label="区属名称:">
                        <div style="width:170px">
                            <el-select v-model="form.qs" placeholder="请选择区属名称" clearable>
                                <el-option v-for="item in qslist" :key="item.value" :label="item.label" :value="item.value">
                                </el-option>
                            </el-select>
                        </div>
                    </el-form-item>
                    <el-form-item label="产别类型:">
                        <div style="width:170px">
                            <el-select v-model="form.cb" placeholder="请选择产别类型" clearable>
                                <el-option v-for="item in cblist" :key="item.code" :label="item.name" :value="item.code">
                                </el-option>
                            </el-select>
                            <!-- <el-input v-model="form.cb" placeholder="请输入产别类型"></el-input> -->
                        </div>
                    </el-form-item>
                    <el-form-item label="权证类型:">
                        <div style="width:170px">
                            <!-- <el-select v-model="form.qzlx" placeholder="请选择权证类型" clearable>
                                <el-option v-for="item in qzlxlist" :key="item.code" :label="item.name" :value="item.code">
                                </el-option>
                            </el-select> -->
                            <el-input v-model="form.qzlx" placeholder="请输入权证类型"></el-input>
                        </div>
                    </el-form-item>
                    <el-form-item label="档案编号:">
                        <div style="width:170px">
                            <el-input v-model="form.dabh" placeholder="请输入档案编号"></el-input>
                        </div>
                    </el-form-item>
                    <el-form-item label="土地使用权类型:">
                        <div style="width:170px">
                            <!-- <el-select v-model="form.tdsyqlx" placeholder="请选择土地使用权类型" clearable>
                                <el-option v-for="item in tdsyqlxlist" :key="item.code" :label="item.name"
                                    :value="item.code">
                                </el-option>
                            </el-select> -->
                            <el-input v-model="form.tdsyqlx" placeholder="请输入土地使用权类型"></el-input>
                        </div>
                    </el-form-item>
                    <el-form-item label="建筑面积:">
                        <div style="width:170px">
                            <el-col :span="11">
                                <el-input v-model="form.jzmja"></el-input>
                            </el-col>
                            <el-col class="line" :span="2"><span style="font-size: 12px;">至</span></el-col>
                            <el-col :span="11">
                                <el-input v-model="form.jzmjb"></el-input>
                            </el-col>
                        </div>
                    </el-form-item>
                    <el-form-item label="风貌建筑:">
                        <div style="width:170px">
                            <el-select v-model="form.fmjz" placeholder="请选择是否为风貌建筑" clearable>
                                <el-option v-for="item in sflist" :key="item.code" :label="item.name" :value="item.code">
                                </el-option>
                            </el-select>
                        </div>
                    </el-form-item>
                    <el-form-item label="小洋楼招商:">
                        <div style="width:170px">
                            <el-select v-model="form.zsxyl" placeholder="请选择是否为小洋楼招商" clearable>
                                <el-option v-for="item in sflist" :key="item.code" :label="item.name" :value="item.code">
                                </el-option>
                            </el-select>
                        </div>
                    </el-form-item>
                    <!-- <el-form-item label="产权单位:">
                        <div style="width:170px">
                            <el-input v-model="form.cqdw" placeholder="请输入产权单位"></el-input>
                        </div>
                    </el-form-item> -->
                    <el-form-item label="房屋地址:">
                        <div style="width:170px">
                            <el-input v-model="form.fwdz" placeholder="请输入房屋地址"></el-input>
                        </div>
                    </el-form-item>
                    <el-form-item label="管房单位:">
                        <div style="width:170px">
                            <el-select v-model="form.gfdw" placeholder="请选择管房单位" :disabled="form.gfdw != ''">
                                <el-option v-for="item in gfdwlist" :key="item.code" :label="item.name" :value="item.code">
                                </el-option>
                            </el-select>
                        </div>
                    </el-form-item>
                    <el-form-item>
                        <el-button type="primary" @click="onSearch" icon="el-icon-search" class="searchcolor">查询</el-button>
                    </el-form-item>
                </el-form>
            </div>
            <el-table :data="tableData" style="width: 100%" :header-cell-style="tableHeaderColor" :row-style="tablerowColor"
                border>
                <el-table-column prop="dabh" label="档案编号" align="center"> </el-table-column>
                <el-table-column prop="qs" label="区属" align="center"> </el-table-column>
                <el-table-column prop="fwdz" label="房屋地址" align="center"> </el-table-column>
                <el-table-column prop="lh" label="楼号" align="center"> </el-table-column>
                <el-table-column prop="fwyt" label="房屋性质" align="center"> </el-table-column>
                <el-table-column prop="cb" label="产别" align="center"> </el-table-column>
                <el-table-column prop="zlc" label="总层数" align="center"> </el-table-column>
                <el-table-column prop="jzmj" label="建筑面积" align="center"> </el-table-column>
                <el-table-column prop="jizumj" label="计租面积" align="center"> </el-table-column>
                <el-table-column label="操作" width="100" align="center">
                    <template slot-scope="scope">
                        <router-link :to="{ name: 'xcdetail', params: { id: scope.row.id } }">
                            <el-button type="text" size="small">巡查</el-button>
                        </router-link>
                    </template>
                </el-table-column>
            </el-table>
            <div class="pagination" style="float: right">
                <el-pagination background layout="total,prev, pager, next,jumper" :total="total" :current-page.sync="current"
                    :page-size="pageSize" @current-change="handleCurrentChange">
                </el-pagination>
            </div>
        </div>
    </div>
</template>

<script>
import { buildlist } from '@/api/index';
import valueList from '@/components/common/valueList.vue'
export default {
    name: 'xclist',
    data() {
        return {
            total: 0,
            current: 1,
            pageSize: 10,
            form: {
                cb: "",
                cqdw: "",
                create_name: "",
                create_name_id: "",
                create_time: "",
                current: 0,
                dabh: "",
                dscs: "",
                dxcs: "",
                fmjz: "",
                fwdz: "",
                fwjg: "",
                fwyt: "",
                fzrq: "",
                id: "",
                jdrq: "",
                jzmj: "",
                jzmja: "",
                jzmjb: "",
                jznd: "",
                jzxs: "",
                note: "",
                pageSize: 10,
                qs: "",
                qzlx: "",
                status_code: 0,
                tdsyqlx: "",
                tdsyqmj: "",
                update_name: "",
                update_name_id: "",
                update_time: "",
                yz: "",
                zlc: "",
                zsbh: "",
                zsxyl: "",
                gfdw: this.$store.getters.gfdw
            },
            tableData: [],
            qslist: valueList.qslist,
            cqdwlist: valueList.cqdwlist,//产权单位
            fwytlist: valueList.fwytlist,//房屋性质
            cblist: valueList.cblist,//产别
            qzlxlist: valueList.qzlxlist,//权证类型
            tdsyqlxlist: valueList.tdsyqlxlist,//土地使用权类型
            sflist: valueList.tdsyqlxlist,//是否列表
            gfdwlist: valueList.tdsyqlxlist,//管房单位
            fjform: {
                zlsb: false,
                db: false,
                mqb: false,
                gr: false,
                zssb: false,
                wyf: false
            },//房间表单
            addlistval: false,
        };
    },
    components: {},
    computed: {},
    methods: {
        // 列表样式
        tableHeaderColor({ row, column, rowIndex, columnIndex }) {
            if (rowIndex === 0) {
                return 'background-color: #f7f7f7;color:black;height: 54px;font-weight: 500;font-size:14px;font-variant:tabular-nums'
            }
        },
        tablerowColor({ row, rowIndex }) {
            return 'height: 42px;font-size:14px;'
        },
        // 换页
        handleCurrentChange(val) {
            this.current = val;
            this.form.current = val;
            this.buildlist(this.form);
            console.log(val);
        },
        // 搜索
        onSearch() {
            this.current = 1;
            this.form.current = 1;
            this.buildlist(this.form);
            console.log('搜索');
        },
        
        // 项目列表
        buildlist(data) {
            buildlist(data).then((res) => {
                if (res.code == 200) {
                    this.tableData = res.data.records;
                    this.total = res.data.total;
                } else {
                    this.tableData = [];
                    this.total = 0;
                }
            });
        },
    },
    mounted() {
        console.log(this.$store.getters)
        this.buildlist(this.form);
        console.log(valueList)
    }
};
</script>

<style scoped>
.container {
    overflow: hidden;
}

.crumbs {
    background-color: #fff;
    padding: 20px 20px;
}

.indexTitle {
    margin-bottom: 20px;
}

.contentsize {
    font-size: 18px;
    font-weight: 700;
}

.handle-box {
    overflow: hidden;
}

/* 新增按钮 */
.addcolor {
    margin-bottom: 10px;
}

.unloadTitle {
    text-align: left;
    padding-bottom: 10px;
    box-sizing: border-box;
    color: #606266;
}
</style>
